home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / xmcd-1.4 / libdi.d / os_odt.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-10  |  4.0 KB  |  135 lines

  1. /*
  2.  *   libdi - CD Audio Player Device Interface Library
  3.  *
  4.  *   Copyright (C) 1995  Ti Kan
  5.  *   E-mail: ti@amb.org
  6.  *
  7.  *   This program is free software; you can redistribute it and/or modify
  8.  *   it under the terms of the GNU General Public License as published by
  9.  *   the Free Software Foundation; either version 2 of the License, or
  10.  *   (at your option) any later version.
  11.  *
  12.  *   This program is distributed in the hope that it will be useful,
  13.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  *   GNU General Public License for more details.
  16.  *
  17.  *   You should have received a copy of the GNU General Public License
  18.  *   along with this program; if not, write to the Free Software
  19.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  *
  21.  *   This software module contains code that interfaces the CD player
  22.  *   application to the SCO Open Desktop operating system.  The name
  23.  *   "SCO" and "ODT" are used here for identification purposes only.
  24.  *   This software and its author are not affiliated with The Santa Cruz
  25.  *   Operation, Inc.
  26.  */
  27. #ifndef __OS_ODT_H__
  28. #define __OS_ODT_H__
  29.  
  30. #if defined(sco) && defined(DI_SCSIPT) && !defined(DEMO_ONLY)
  31.  
  32. #ifndef LINT
  33. static char *_os_odt_h_ident_ = "@(#)os_odt.h    5.4 94/12/28";
  34. #endif
  35.  
  36. #include <sys/scsi.h>
  37. #include <sys/scsicmd.h>
  38.  
  39.  
  40. #define OS_MODULE    /* Indicate that this is compiled on a supported OS */
  41. #define SETUID_ROOT    /* Setuid root privilege is required */
  42.  
  43.  
  44. /* Macros to update various fields of the SCSI CDB structures.
  45.  * These are used to work around byte alignment restrictions and
  46.  * padding with some compilers.  In general, define NO_ALIGN_LIMIT
  47.  * if and only if you are sure that the compiler will not insert
  48.  * pad bytes between any field of the SCSI CDB structure.
  49.  */
  50.  
  51. #ifdef NO_ALIGN_LIMIT
  52.  
  53. #define CDB6_BLK(a,d)    (a)->data[0] = (byte_t) (d);        \
  54.             (a)->data[1] = (byte_t) ((d) >> 8);
  55. #define CDB6_LEN(a,d)    (a)->data[2] = (d)
  56. #define CDB6_CTL(a,d)    (a)->control = (d)
  57. #define CDB10_BLK(a,d)    (a)->block = (d)
  58. #define CDB10_LEN(a,d)    (a)->length = (d)
  59. #define CDB10_RSV(a,d)    (a)->reserved = (d)
  60. #define CDB10_CTL(a,d)    (a)->control = (d)
  61. #define CDB12_BLK(a,d)    (a)->block = (d)
  62. #define CDB12_LEN(a,d)    (a)->length = (d)
  63. #define CDB12_RSV(a,d)    (a)->reserved = (d)
  64. #define CDB12_CTL(a,d)    (a)->control = (d)
  65.  
  66. #else    /* !NO_ALIGN_LIMIT */
  67.  
  68. #if _BYTE_ORDER_ == _L_ENDIAN_
  69.  
  70. #define CDB6_BLK(a,d)    {                    \
  71.     register word16_t *p = (word16_t *)(void *) (a);    \
  72.     p[1] = (d);                        \
  73. }
  74. #define CDB6_LEN(a,d)    {                    \
  75.     register byte_t *p = (byte_t *) (a);            \
  76.     p[4] = (d);                        \
  77. }
  78. #define CDB6_CTL(a,d)    {                    \
  79.     register byte_t *p = (byte_t *) (a);            \
  80.     p[5] = (d);                        \
  81. }
  82. #define CDB10_BLK(a,d)    {                    \
  83.     register word16_t *p = (word16_t *)(void *) (a);    \
  84.     p[1] = (word16_t) (d);                    \
  85.     p[2] = (word16_t) ((d) >> 16);                \
  86. }
  87. #define CDB10_LEN(a,d)    {                    \
  88.     register byte_t *p = (byte_t *) (a);            \
  89.     p[7] = (byte_t) (d);                    \
  90.     p[8] = (byte_t) ((d) >> 8);                \
  91. }
  92. #define CDB10_RSV(a,d)    {                    \
  93.     register byte_t *p = (byte_t *) (a);            \
  94.     p[6] = (d);                        \
  95. }
  96. #define CDB10_CTL(a,d)    {                    \
  97.     register byte_t *p = (byte_t *) (a);            \
  98.     p[9] = (d);                        \
  99. }
  100. #define CDB12_BLK(a,d)    {                    \
  101.     register word16_t *p = (word16_t *)(void *) (a);    \
  102.     p[1] = (word16_t) (d);                    \
  103.     p[2] = (word16_t) ((d) >> 16);                \
  104. }
  105. #define CDB12_LEN(a,d)    {                    \
  106.     register word16_t *p = (word16_t *)(void *) (a);    \
  107.     p[3] = (word16_t) (d);                    \
  108.     p[4] = (word16_t) ((d) >> 16);                \
  109. }
  110. #define CDB12_RSV(a,d)    {                    \
  111.     register byte_t *p = (byte_t *) (a);            \
  112.     p[10] = (d);                        \
  113. }
  114. #define CDB12_CTL(a,d)    {                    \
  115.     register byte_t *p = (byte_t *) (a);            \
  116.     p[11] = (d);                        \
  117. }
  118.  
  119. #endif    /* _BYTE_ORDER_ == _L_ENDIAN_ */
  120.  
  121. #endif    /* !NO_ALIGN_LIMIT */
  122.  
  123.  
  124. /* Public function prototypes */
  125. extern bool_t    pthru_send(byte_t, word32_t, byte_t *, word32_t, byte_t,
  126.             word32_t, byte_t, byte_t, byte_t, bool_t);
  127. extern bool_t    pthru_open(char *);
  128. extern void    pthru_close(void);
  129. extern char    *pthru_vers(void);
  130.  
  131. #endif    /* sco DI_SCSIPT DEMO_ONLY */
  132.  
  133. #endif    /* __OS_ODT_H__ */
  134.  
  135.